home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Libris Britannia 4
/
science library(b).zip
/
science library(b)
/
PROGRAMM
/
PROGEDIT
/
0748.ZIP
/
BOX
< prev
next >
Wrap
Text File
|
1986-12-29
|
1KB
|
60 lines
#define CTRL_B 2
#define CTRL_C 3
#define BOXCHAR "*"
init()
{
assign_key("box", CTRL_B); /* <CTRL> B */
assign_key("center", CTRL_C); /* <CTRL> C */
}
/* box() - this macro draws a comment box around a marked region */
box()
{
int col1, col2; /* starting and ending columns of the marked region */
int line1, line2; /* starting and ending lines of the marked region */
int width; /* number of characters across (really col2-col1+1) */
col1 = marked_col(); col2 = currcol();
line1 = marked_line(); line2 = currlinenum();
width = col2 - col1 + 1;
goline(line1);
insline();
setcol(col1);
insert(strcat("/", repstr(BOXCHAR, width)));
down();
while (currlinenum() <= line2 + 1)
{
setcol(col1);
insert("*");
setcol(col2+1);
insert(BOXCHAR);
down();
}
insline();
setcol(col1);
insert(strcat(repstr(BOXCHAR, width), "/"));
clear_mark();
}
/* This macro centers the current line */
center()
{
string text;
text = currline();
gobol(); /* get rid of the characters in the line */
deleol();
ltrim(text); /* remove leading & trailing blanks */
rtrim(text);
setcol((80 - strlen(text)) / 2); /* go to midway point */
insert(text); /* re-insert the text */
gobol(); /* move to the next line down */
down();
}